
#ifndef _PCA9555_H
#define _PCA9555_H

/********************************************************************************************
 * Included Files
 ********************************************************************************************/
	#include "sim_i2c.h"
	#include "osal.h"
	#include <stdio.h>

	/* PCA9538 Resources ************************************************************************/
	#define PCA9555_GPIO_NPINS 		16 /* All pins can be used as GPIOs */
	#define PCA9555_ADDR          0x20

	/* PCA9555 Registers ************************************************************************/
	/* Register Addresses */

	#define PCA9555_REG_IN0                 0x00                                    //输入寄存器0地址
	#define PCA9555_REG_IN1                 0x01                                    //输入寄存器1地址
	#define PCA9555_REG_OUT0                0x02                                    //输出寄存器0地址
	#define PCA9555_REG_OUT1                0x03                                    //输出寄存器1地址
	#define PCA9555_REG_POL0                0x04                                    //极性反转寄存器0地址(PIN脚为输入时有效)
	#define PCA9555_REG_POL1                0x05                                    //极性反转寄存器1地址
	#define PCA9555_REG_CFG0                0x06                                    //方向配置寄存器0地址
	#define PCA9555_REG_CFG1                0x07                                    //方向配置寄存器1地址

	#define PCA9555_DERECTION0          0x00                                    //方向配置值0 (0输出 1输入)
	#define PCA9555_DERECTION1          0x00                                    //方向配置值1

	extern uint8_t pca9555_setbit(uint8_t pin, uint8_t bitval);
	extern uint8_t pca9555_getbit( uint8_t pin, uint8_t *val);
	extern uint8_t pca9555_getall(uint8_t *data);
	extern uint8_t pca9555_init(void);
#endif
